package java8stream;

import java.util.stream.Stream;

/**
 * Created by ZhuQianli on 2018/1/17.
 */
public class Iterate {

    public static void main(String[] args) {

        // 等比队列
        Stream.iterate(1, e -> e * 2).limit(10).forEach(System.out::println);

        // 等差队列
        Stream.iterate(1, integer -> integer + 2).limit(20).forEach(integer -> System.out.print(integer + " "));


    }

}
